package com.wangshen.base.ui.mvp.base.ui;

import android.content.Context;
import android.os.Bundle;


import androidx.activity.ComponentActivity;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;

import com.alibaba.android.arouter.launcher.ARouter;
import com.wangshen.base.R;
import com.wangshen.base.util.OSHelper;
import com.wangshen.base.util.StatusBarUtils;

import butterknife.ButterKnife;

/**
 * @name ProjectBase
 * @class describe
 * @anthor 王文章
 * @time 2018/10/31 10:23
 * @change
 */
public abstract class BaseActivity extends FragmentActivity {

    protected Context mContext=this;
    protected String TGA=getClass().getSimpleName();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getView());
        ButterKnife.bind(this);
        StatusBarUtils.statusBarLightMode(this,true);

        if (OSHelper.isMiui()==true){
            StatusBarUtils.setStatusBarColor(this, R.color.transparent_new);
        }else {
            StatusBarUtils.setStatusBarColor(this, R.color.transparent);
        }

       /* getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(getResources().getColor(R.color.transparent));
        }*/
    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        getData();
        initView();
        initLinsenterner();
    }
    public void startIntent(String key,Bundle bundle){
        ARouter.getInstance().build(key).with(bundle).navigation(this);
    }
    public void startIntent(String key){
        ARouter.getInstance().build(key).navigation(this);
    }
    public abstract int getView();
    public abstract void initView();
    public abstract void initLinsenterner();
    public abstract void getData();
}
